package com.panopset.sf;

import com.panopset.centralen.resource.ImageResource;

/**
 * RezIcon image. Provide the path to a png image in the constructor:
 *
 * <pre>
 * new RezIcon(&quot;/com/mycompany/icons/my16x16logo.png&quot;);
 * </pre>
 *
 * @see ImageResource
 *
 * @author Karl Dinwiddie
 *
 */
public final class RezIcon {

    /**
     * Path to RezIcon.
     */
    private final String path;

    /**
     * RezIcon constructor. This sets the application RezIcon to the new image
     * provided in packagePath.
     *
     * @param packagePath
     *            Image should be a png image.
     */
    public RezIcon(final String packagePath) {
        path = packagePath;
    }

    /**
     * Image resource for RezIcon.
     */
    private ImageResource imageResource;

    /**
     * Get image resource for this RezIcon.
     *
     * @return ImageResource.
     */
    public ImageResource getImageResource() {
        if (imageResource == null) {
            imageResource = new ImageResource(getPath());
        }
        return imageResource;
    }

    /**
     * Get path.
     *
     * @return package path.
     */
    public String getPath() {
        return path;
    }

}
